home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue45 / Construc / UNIT2.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  2000-11-02  |  1.7 KB  |  64 lines

  1. unit Unit2;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, ComObj, StdVcl,
  5.   CorbaObj, BobNotes_TLB;
  6.  
  7. type
  8.   TCorBobNotes = class(TCorbaImplementation, ICorBobNotes)
  9.   private
  10.     { Private declarations }
  11.   public
  12.     { Public declarations }
  13.   protected
  14.     procedure GetLines(const User, Password: WideString;
  15.       out Lines: WideString); safecall;
  16.     procedure SetLines(const User, Password, Lines: WideString); safecall;
  17.   end;
  18.  
  19. implementation
  20. uses
  21.   CorbInit, IniMod, Unit1;
  22.  
  23. procedure TCorBobNotes.GetLines(const User, Password: WideString;
  24.   out Lines: WideString);
  25. var
  26.   Notes: TStringList;
  27. begin
  28.   Form1.Memo1.Lines.Add('---');
  29.   Form1.Memo1.Lines.Add('Call to GetLines:');
  30.   Form1.Memo1.Lines.Add(' User = ['+User+']');
  31.   Form1.Memo1.Lines.Add(' Password = ['+Password+']');
  32.   Notes := TStringList.Create;
  33.   try
  34.     IniMod.GetLines(User, Password, Notes);
  35.     Lines := Notes.Text;
  36.   finally
  37.     Notes.Free
  38.   end;
  39.   Form1.Memo1.Lines.Add(' Lines = ['+Lines+']')
  40. end;
  41.  
  42. procedure TCorBobNotes.SetLines(const User, Password, Lines: WideString);
  43. var
  44.   Notes: TStringList;
  45. begin
  46.   Form1.Memo1.Lines.Add('---');
  47.   Form1.Memo1.Lines.Add('Call to SetLines:');
  48.   Form1.Memo1.Lines.Add(' User = ['+User+']');
  49.   Form1.Memo1.Lines.Add(' Password = ['+Password+']');
  50.   Notes := TStringList.Create;
  51.   try
  52.     Notes.Text := Lines;
  53.     IniMod.SetLines(User, Password, Notes);
  54.   finally
  55.     Notes.Free
  56.   end;
  57.   Form1.Memo1.Lines.Add(' Lines = ['+Lines+']')
  58. end;
  59.  
  60. initialization
  61.   TCorbaObjectFactory.Create('CorBobNotesFactory', 'CorBobNotes', 'IDL:BobNotes/CorBobNotesFactory:1.0', ICorBobNotes,
  62.     TCorBobNotes, iMultiInstance, tmSingleThread);
  63. end.
  64.